/*
 *  ImageVars.h
 *  3D Engine GLUT
 *
 *  Created by Alex Nesta on 3/6/10.
 *  Copyright 2010 Holy Cross High School. All rights reserved.
 *
 */

TGAImg BackGround;
TGAImg CampaignSel;
TGAImg CampaignUSel;
TGAImg OptionsSel;
TGAImg OptionsUSel;
TGAImg CreditsSel;
TGAImg CreditsUSel;
TGAImg ExitSel;
TGAImg ExitUSel;


void LoadImages (void)
{

	BackGround.Load("../../Menu/BackGround.tga");
	CampaignSel.Load("../../Menu/CampaignSelected.tga");
	CampaignUSel.Load("../../Menu/CampaignUnselected.tga");
	OptionsSel.Load("../../Menu/OptionsSelected.tga");
	OptionsUSel.Load("../../Menu/OptionsUnselected.tga");
	CreditsSel.Load("../../Menu/CreditsSelected.tga");
	CreditsUSel.Load("../../Menu/CreditsUnselected.tga");
	ExitSel.Load("../../Menu/ExitSelected.tga");
	ExitUSel.Load("../../Menu/ExitUnselected.tga");
	
		//Trying to convert all these to GenImg. In other words, soon deprecated
		//glTexImage2D(GL_TEXTURE_2D,0,3,BackGround.GetWidth(),BackGround.GetHeight(),0,GL_RGB,GL_UNSIGNED_BYTE,BackGround.GetImg());
		//glTexImage2D(GL_TEXTURE_2D,0,3,CampaignSel.GetWidth(),CampaignSel.GetHeight(),0,GL_RGB,GL_UNSIGNED_BYTE,CampaignSel.GetImg());
		//glTexImage2D(GL_TEXTURE_2D,0,3,CampaignSel.GetWidth(),CampaignSel.GetHeight(),0,GL_RGB,GL_UNSIGNED_BYTE,CampaignSel.GetImg());
		//glTexImage2D(GL_TEXTURE_2D,0,3,CampaignUSel.GetWidth(),CampaignUSel.GetHeight(),0,GL_RGB,GL_UNSIGNED_BYTE,CampaignUSel.GetImg());
		//glTexImage2D(GL_TEXTURE_2D,0,3,OptionsSel.GetWidth(),OptionsSel.GetHeight(),0,GL_RGB,GL_UNSIGNED_BYTE,OptionsSel.GetImg());
		//glTexImage2D(GL_TEXTURE_2D,0,3,OptionsUSel.GetWidth(),OptionsUSel.GetHeight(),0,GL_RGB,GL_UNSIGNED_BYTE,OptionsUSel.GetImg());
		//glTexImage2D(GL_TEXTURE_2D,0,3,CreditsSel.GetWidth(),CreditsSel.GetHeight(),0,GL_RGB,GL_UNSIGNED_BYTE,CreditsSel.GetImg());
		//glTexImage2D(GL_TEXTURE_2D,0,3,CreditsUSel.GetWidth(),CreditsUSel.GetHeight(),0,GL_RGB,GL_UNSIGNED_BYTE,CreditsUSel.GetImg());
		//glTexImage2D(GL_TEXTURE_2D,0,3,ExitSel.GetWidth(),ExitSel.GetHeight(),0,GL_RGB,GL_UNSIGNED_BYTE,ExitSel.GetImg());
		//glTexImage2D(GL_TEXTURE_2D,0,3,ExitUSel.GetWidth(),ExitUSel.GetHeight(),0,GL_RGB,GL_UNSIGNED_BYTE,ExitUSel.GetImg());


}

void GenImg(TGAImg ImgName, int x, int y)
{
	
	glTexImage2D(GL_TEXTURE_2D,0,4,ImgName.GetWidth(),ImgName.GetHeight(),0,GL_RGB,GL_UNSIGNED_BYTE,ImgName.GetImg());
	
	glBegin(GL_QUADS);
	glTexCoord2d(0.0,0.0); glVertex2d(x,y);
	glTexCoord2d(1.0,0.0); glVertex2d(ImgName.GetWidth() + x,y);
	glTexCoord2d(1.0,1.0); glVertex2d(ImgName.GetWidth() + x,y - ImgName.GetHeight());
	glTexCoord2d(0.0,1.0); glVertex2d(x,y - ImgName.GetHeight());
	glEnd();
}
